package queries;

import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;

import entitys.Customer;
import entitys.Request;

public class GetMarketingSalesByEmpQuery {
/**
 * Execute query
 * @param req
 * @param conn
 * @return
 */
	public static Object exe(Request req, Connection conn) {
		
		ArrayList<String> arr = new ArrayList<String>();
		ResultSet res = null; 
		Statement stmt;
			try {
				stmt = conn.createStatement();
				res = stmt.executeQuery("SELECT DISTINCT m.marketingSaleID FROM marketingsalesaddressing AS m, marketingsales AS ms where m.empID='"+req.getUserID()+"'AND ms.id=m.marketingSaleID AND ms.isActive='1';");
				while(res.next())
				{
					arr.add(""+res.getString(1));
	
				}
			} catch (SQLException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
				return null;
			}
		return arr;
	}

}
